|
|
|
|
|
|
|
Examples Filename: Error.frm |
|
|
|
|
|
|
|
|
Although this dialog box is a far cry from a good error-handling solution, it at least gives the user a little more information, and it also explains how to handle the problem. |
|
|
|
|
|
|
|
|
Error handling is very important in any application. Its very important to include error handling in every procedure that could potentially cause an error. There are many ways to handle errors in a Visual Basic application. Its up to you to choose the best method of error handling. I recommend that you create a global error handler to handle the majority of normal errors. Then you can just add specific code in each procedure that needs it. |
|
|
|
|
|
|
|
|
1. Write an error statement that causes VB to jump to a label named FormLoad_EH. |
|
|
|
|
|
|
|
|
2. Which statement causes execution to continue at the line following the one where the error occurred? |
|
|
|
|
|
|
|
|
3. Which object/property returns a string describing the error that just occurred? |
|
|
|
|
|
|
|
|
4. Write a statement that turns off error handling. |
|
|
|
|
|
|
|
|
If you use the common dialog control and you click the Cancel button on the File Open or File Save As dialog box, a trappable error will occur. Add this type of error handling to a program that traps this error. |
|
|
|
|
|